home *** CD-ROM | disk | FTP | other *** search
/ MacGames Sampler / PHT MacGames Bundle.iso / MacSource Folder / Samples from the CD / Editors / emacs / Emacs-1.14b1 / lisp / mac / AppleEvents.el < prev    next >
Encoding:
Text File  |  1994-03-08  |  6.6 KB  |  220 lines  |  [TEXT/EMAC]

  1. ;;;
  2. ;;; This file is part of a Macintosh port of GNU Emacs.
  3. ;;; Copyright (C) 1993, 1994 Marc Parmet.  All rights reserved.
  4. ;;;
  5. ;;; GNU Emacs is distributed in the hope that it will be useful,
  6. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  8. ;;; GNU General Public License for more details.
  9. ;;;
  10.  
  11. ;pascal OSErr
  12. ;AEDisposeDesc( AEDesc *theAEDesc )
  13. ;   = {0x303C,0x0204,0xA816};
  14. (deftrap AEDisposeDesc ("303c" "0204" "a816")
  15.   ((theAEDesc address))
  16.   short)
  17.  
  18. ;pascal OSErr
  19. ;AESend( const AppleEvent *theAppleEvent, AppleEvent *reply,
  20. ;    AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks,
  21. ;     IdleProcPtr idleProc, EventFilterProcPtr filterProc )
  22. ;   = {0x303C,0x0D17,0xA816};
  23. (deftrap AESend ("303c" "0d17" "a816")
  24.   ((theAppleEvent address)
  25.    (reply address)
  26.    (sendMode long)
  27.    (sendPriority short)
  28.    (timeOutInTicks long)
  29.    (idleProc long)
  30.    (filterProc long))
  31.   short)
  32.  
  33. ;pascal OSErr
  34. ;AECountItems( const AEDescList *theAEDescList, long *theCount )
  35. ;   = {0x303C,0x0407,0xA816}; 
  36. (deftrap AECountItems ("303c" "0407" "a816")
  37.   ((theAEDescList address)
  38.    (theCount address))
  39.   short)
  40.  
  41. ;pascal OSErr
  42. ;AESizeOfNthItem( const AEDescList *theAEDescList, long index,
  43. ;         DescType *typeCode, Size *dataSize )
  44. ;   = {0x303C,0x082A,0xA816};
  45. (deftrap AESizeOfNthItem ("303c" "082a" "a816")
  46.   ((theAEDescList address)
  47.    (index long)
  48.    (typeCode address)
  49.    (dataSize address))
  50.   short)
  51.  
  52. ;pascal OSErr
  53. ;AESizeOfParam( const AppleEvent *theAppleEvent, AEKeyword theAEKeyword,
  54. ;        DescType *typeCode, Size *dataSize )
  55. ;   = {0x303C,0x0829,0xA816};
  56. (deftrap AESizeOfParam ("303c" "0829" "a816")
  57.   ((theAppleEvent address)
  58.    (theAEKeyword immediate-string)
  59.    (typeCode address)
  60.    (dataSize address))
  61.   short)
  62.  
  63. ; pascal OSErr
  64. ; AEPutParamPtr( const AppleEvent *theAppleEvent, AEKeyword theAEKeyword,
  65. ;        DescType typeCode, const void* dataPtr, Size dataSize )
  66. ;   = {0x303C,0x0A0F,0xA816};
  67. (deftrap AEPutParamPtr ("303c" "0a0f" "a816")
  68.   ((theAppleEvent address)
  69.    (theAEKeyword immediate-string)
  70.    (typeCode immediate-string)
  71.    (dataPtr address)
  72.    (dataSize long))
  73.   short)
  74.  
  75. ; pascal OSErr
  76. ; AEPutParamDesc( const AppleEvent *theAppleEvent, AEKeyword theAEKeyword,
  77. ;         const AEDesc *theAEDesc )
  78. ;   = {0x303C,0x0610,0xA816};
  79. (deftrap AEPutParamDesc ("303c" "0610" "a816")
  80.   ((theAppleEvent address)
  81.    (theAEKeyword immediate-string)
  82.    (theAEDesc address))
  83.   short)
  84.  
  85. ; pascal OSErr
  86. ; AEPutPtr( const AEDescList *theAEDescList, long index, DescType typeCode,
  87. ;       const void* dataPtr, Size dataSize )
  88. ;   = {0x303C,0x0A08,0xA816};
  89. (deftrap AEPutPtr ("303c" "0a08" "a816")
  90.   ((theAEDescList address)
  91.    (index long)
  92.    (typeCode immediate-string)
  93.    (dataPtr address)
  94.    (dataSize long))
  95.   short)
  96.  
  97. ; pascal OSErr
  98. ; AEInstallEventHandler( AEEventClass theAEEventClass, AEEventID theAEEventID,
  99. ;            EventHandlerProcPtr handler, long handlerRefcon,
  100. ;            Boolean isSysHandler )
  101. ;   = {0x303C,0x091F,0xA816};
  102. (deftrap AEInstallEventHandler-internal ("303c" "091f" "a816")
  103.   ((theAEEventClass immediate-string)
  104.    (theAEEventID immediate-string)
  105.    (handler address)
  106.    (handlerRefCon address)
  107.    (isSysHandler short))
  108.   short)
  109.  
  110. ;;; This list is really only used now to protect the cons cells stored in the
  111. ;;; refCon slots of the dispatch table from being garbage collected, and for
  112. ;;; documentation.
  113. (defvar ae-callback-list nil "The list of Apple event handlers")
  114.  
  115. ;;; This is called from C when receiving an Apple event registered from elisp.
  116. (defun ae-receive (event reply refCon)
  117.   (funcall (car refCon) event reply (cdr refCon)))
  118.  
  119. (defun AEInstallEventHandler (class type callback handlerRefCon isSysHandler)
  120.   (let* ((callback-cons (cons callback handlerRefCon))
  121.          (err (AEInstallEventHandler-internal class type ae-receive
  122.                                               callback-cons isSysHandler)))
  123.     (if (not (zerop err))
  124.         err
  125.       (setq ae-callback-list (cons (list class type callback-cons) ae-callback-list))
  126.       noErr)))
  127.  
  128. ; pascal OSErr
  129. ; AEGetParamPtr( const AppleEvent *theAppleEvent, AEKeyword theAEKeyword,
  130. ;        DescType desiredType, DescType *typeCode, void* dataPtr,
  131. ;        Size maximumSize, Size *actualSize )
  132. ;   = {0x303C,0x0E11,0xA816};
  133. (deftrap AEGetParamPtr ("303c" "0e11" "a816")
  134.   ((theAppleEvent address)
  135.    (theAEKeyword immediate-string)
  136.    (desiredType immediate-string)
  137.    (typeCode address)
  138.    (dataPtr address)
  139.    (maximumSize long)
  140.    (actualSize address))
  141.   short)
  142.  
  143. ; pascal OSErr
  144. ; AEGetAttributePtr( const AppleEvent *theAppleEvent, AEKeyword theAEKeyword,
  145. ;            DescType desiredType, DescType *typeCode, void* dataPtr,
  146. ;            Size maximumSize, Size *actualSize )
  147. ;   = {0x303C,0x0E15,0xA816};
  148. (deftrap AEGetAttributePtr ("303c" "0e15" "a816")
  149.   ((theAppleEvent address)
  150.    (theAEKeyword immediate-string)
  151.    (desiredType immediate-string)
  152.    (typeCode address)
  153.    (dataPtr address)
  154.    (maximumSize long)
  155.    (actualSize address))
  156.   short)
  157.  
  158. ; pascal OSErr
  159. ; AEGetNthPtr( const AEDescList *theAEDescList, long index, DescType desiredType,
  160. ;          AEKeyword *theAEKeyword, DescType *typeCode, void* dataPtr,
  161. ;          Size maximumSize, Size *actualSize )
  162. ;   = {0x303C,0x100A,0xA816}; 
  163.  
  164. (deftrap AEGetNthPtr ("303c" "100a" "a816")
  165.   ((theAEDescList address)
  166.    (index long)
  167.    (desiredType immediate-string)
  168.    (theAEKeyword address)
  169.    (typeCode address)
  170.    (dataPtr address)
  171.    (maximumSize long)
  172.    (actualSize address))
  173.   short)
  174.  
  175. ; pascal OSErr
  176. ; AEGetParamDesc( const AppleEvent *theAppleEvent, AEKeyword theAEKeyword,
  177. ;         DescType desiredType, AEDesc *result )
  178. ;   = {0x303C,0x0812,0xA816};
  179. (deftrap AEGetParamDesc ("303c" "0812" "a816")
  180.   ((theAppleEvent address)
  181.    (theAEKeyword immediate-string)
  182.    (desiredType immediate-string)
  183.    (result address))
  184.   short)
  185.  
  186. ; pascal OSErr
  187. ; AECreateList( const void* factoringPtr, Size factoredSize, Boolean isRecord,
  188. ;           AEDescList *resultList )
  189. ;   = {0x303C,0x0706,0xA816}; 
  190. (deftrap AECreateList ("303c" "0706" "a816")
  191.   ((factoringPtr address)
  192.    (factoredSize long)
  193.    (isRecord char)
  194.    (resultList address))
  195.   short)
  196.  
  197. ; pascal OSErr
  198. ; AECreateDesc( DescType typeCode, const void* dataPtr, Size dataSize, AEDesc *result )
  199. ;   = {0x303C,0x0825,0xA816};
  200. (deftrap AECreateDesc ("303c" "0825" "a816")
  201.   ((typeCode immediate-string)
  202.    (dataPtr address)
  203.    (dataSize long)
  204.    (result address))
  205.   short)
  206.  
  207. ; pascal OSErr
  208. ; AECreateAppleEvent( AEEventClass theAEEventClass, AEEventID theAEEventID,
  209. ;             const AEAddressDesc *target, short returnID,
  210. ;             long transactionID, AppleEvent *result )
  211. ;   = {0x303C,0x0B14,0xA816};
  212. (deftrap AECreateAppleEvent ("303c" "0b14" "a816")
  213.   ((theAEEventClass immediate-string)
  214.    (theAEEventID immediate-string)
  215.    (target address)
  216.    (returnID short)
  217.    (transactionID long)
  218.    (result address))
  219.   short)
  220.